package com.heima;

import com.heima.Service.ScheduleSerice;
import com.heima.model.schedule.pojos.Task;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Date;

@SpringBootTest
public class test1 {
    @Autowired
    ScheduleSerice scheduleSerice;

    @Test
    public void addtask()
    {
        Task task=new Task();
        task.setTaskType(100);
        task.setPriority(50);
        task.setParameters("hhh".getBytes());
        task.setExecuteTime(new Date().getTime());
        scheduleSerice.AddTask(task);
    }
    @Test
    public void test1()
    {
        for (int i = 0; i < 5; i++) {
            Task task = new Task();
            task.setTaskType(100+i);
            task.setPriority(50);
            task.setParameters("task test".getBytes());
            task.setExecuteTime(new Date().getTime()+500*i);

            scheduleSerice.AddTask(task);
        }
    }

}
